﻿using System;
using GameFramework;

namespace StarForce
{
    public static class TextHelp
    {
        /// <summary>根据类型和名称获取完整名称。</summary>
        /// <typeparam name="T">类型。</typeparam>
        /// <param name="name">名称。</param>
        /// <returns>完整名称。</returns>
        public static string GetFullName<T>(string name) => GetFullName(typeof (T), name);

        /// <summary>根据类型和名称获取完整名称。</summary>
        /// <param name="type">类型。</param>
        /// <param name="name">名称。</param>
        /// <returns>完整名称。</returns>
        public static string GetFullName(Type type, string name)
        {
            string str = type != null ? type.FullName : throw new GameFrameworkException("Type is invalid.");
            return !string.IsNullOrEmpty(name) ? Utility.Text.Format("{0}.{1}", (object) str, (object) name) : str;
        }
    }
}